home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #2 / Monster Media No. 2 (Monster Media)(1994).ISO / utils1 / 22nce142.zip / IOSKEL.ASM < prev    next >
Assembly Source File  |  1994-07-06  |  3KB  |  87 lines

  1.     page    ,132
  2.     title    IOM_Skeleton - I/O Map Skeleton
  3.  
  4.     .model    small,c
  5.     .code
  6.     assume    cs:@Code,ds:@Code,es:@Code,ss:nothing
  7.  
  8. ; --------------------------------------------------------------------
  9. ;    Note that this program is assumed to be loaded at 0000 in the
  10. ;    current segment.
  11. ;
  12. ;    This overlay can be compiled with -
  13. ;
  14. ;        ML /Fe ioskel.iom ioskel.asm /link /T
  15. ;
  16. ;    An IOMAP overlay must begin with the following header:
  17. ; ---------------------------------------------------------------------
  18.  
  19.  
  20. IOMAP_MAX_SIZE    equ    32767        ; size of largest I/O map processor
  21. IOMAP_SIGNATURE equ    'MI'        ; IO Map signature
  22.  
  23. ;    Layout of an IOMap comm block.
  24.  
  25. IOMAPB        struc
  26. iom_ident    dw    ?        ; identifier of IOM
  27. iom_init    dw    ?        ; offset of initialization routine
  28. iom_deinit    dw    ?        ; offset of de-init routine
  29. iom_input    dw    ?        ; offset of input routine
  30. iom_output    dw    ?        ; offset of output routine
  31. iom_interrupt    dd    ?        ; interrupt callback vector
  32. iom_reserved    dw    8 dup (?)    ; reserved, zero
  33. IOMAPB        ends
  34.  
  35. ;    Note that routines not used need not have "stubs"; an all-zero
  36. ;    offset will be ignored by 22Nice.
  37.  
  38.     IOMAPB    <IOMAP_SIGNATURE, offset Init, offset DeInit, offset Input,\
  39.          offset Output, 0>
  40.  
  41. ;    The Init routine is called before any program code is actually
  42. ;    executed.
  43.  
  44. Init        proc    far
  45.     ret
  46. Init        endp
  47.  
  48. ;    The DeInit routine is called after the program execution has
  49. ;    terminated.  Both normal and error termination go through here.
  50.  
  51. DeInit        proc    far
  52.     ret
  53. DeInit        endp
  54.  
  55. ;    I/O processors have the I/O port in (bl) and the data byte in (al).
  56. ;    Any registers may be used, but the stack must be preserved.  Output
  57. ;    preserves (AL), and Input expects the I/O data to be returned in
  58. ;    (AL).
  59.  
  60. Input        proc    far
  61.     ret
  62. Input        endp
  63.  
  64. Output        proc    far
  65.     ret
  66. Output        endp
  67.  
  68. ;    The interrupt callback vector is used by 80x86 interrupt servicers
  69. ;    that want to emulate a Z-80 or 8080 interrupt.    To enable the
  70. ;    interrupt handling, the iom_interrupt field in the IOMAPB block
  71. ;    must be assembled as non-zero to show that interrupt emulation
  72. ;    processing is required by this map.
  73. ;
  74. ;    After 22nice has completed loading the emulated program, a
  75. ;    doubleword pointer to a two-byte word will be inserted in the
  76. ;    iom_interrupt field.
  77. ;
  78. ;    When an interrupt is processed by the 80x86 handler, a Z-80 or
  79. ;    8080 interrupt may be emulated by storing the Z-80 or 8080
  80. ;    P-counter value into the word pointed to by iom_interrupt.
  81. ;    The emulation software will read this value, simulate an
  82. ;    interrupt and set the value pointed to by iom_interrupt to zero.
  83. ;    This means that you can interrupt to any location except 0000.
  84.  
  85.  
  86.     end
  87.